package com.sdry.mapper.cb;

import com.sdry.model.cb.AmoebaEntity;
import com.sdry.model.cb.DepreciationEntity;
import com.sdry.model.cb.ShareEntity;
import com.sdry.model.llm.LlmPrepaidExpenses;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

public interface AmoebaMapper {

    //叉车，扫地车折旧
    BigDecimal chaCheZheJiu(@Param("stockId") Long stockId, @Param("date")String date);

    // 折旧费用去除掉叉车扫地车
    List<DepreciationEntity> zheJiuFie(@Param("date") String date, @Param("stockId") Long stockId);

    //叉车租赁
    BigDecimal cheCheZuLin(@Param("stockId") Long stockId, @Param("date")String date);

    //其他
    @Select("select ISNULL(sum(monery), 0) as monery from cb_otherCost_t where datediff(month,createDate,#{date})=0  and del = 0 and warehouse = #{stockId}")
    BigDecimal qiTa(@Param("date") String date, @Param("stockId") Long stockId);

    //查询底薪总和
    BigDecimal gongZi(@Param("date") String date, @Param("stockId") Long stockId);
    //查询月过桥费总和
    BigDecimal guoQiaoFei(@Param("date") String date, @Param("stockId") Long stockId);
    //-查询月油费总和
    BigDecimal youFei(@Param("date") String date, @Param("stockId") Long stockId);
    //查询月维修费总和
    BigDecimal weiXiuFei(@Param("date") String date, @Param("stockId") Long stockId);
    //查询月外雇车总和
    BigDecimal waiGuChe(@Param("date") String date, @Param("stockId") Long stockId);
    //查询月服务费总和
    BigDecimal fuWuFei(@Param("stockId") Long stockId, @Param("date")String date);
    //查询月社保费总和
    BigDecimal sheBaoFei(@Param("stockId") Long stockId, @Param("date")String date);
    //待摊
    BigDecimal daiTanFei(@Param("date") String date, @Param("warehouseId") Long warehouseId);
    //重庆飞公司明细
    @Select("select  sum(money) as money from zy_share where flag = 1 and datediff(month,ctime,#{date})=0  and warehouseid = #{warehouseId}")
    BigDecimal fenGongSiMingXi(@Param("date") String date,@Param("warehouseId") Long warehouseId);

    @Select("select * from zy_share , ( SELECT id AS wid, warehouse_name warehouseName FROM lz_warehouse WHERE status = 0 ) t1  where  flag = 1  and warehouseid = t1.wid and warehouseid = #{warehouseId} and CONVERT(VARCHAR(7),ctime,120) = #{date}")
    List<ShareEntity> getShareList(@Param("date") String date,@Param("warehouseId") Long warehouseId);

    @Update("update zy_share set flag = 0 where id = #{id}")
    Integer setDelete(Long id);

    List<LlmPrepaidExpenses> getAmortizationList(@Param("warehouseId") Long warehouseId, @Param("dateOfOccurrence") String dateOfOccurrence);

    Integer amoebaUpdate(@Param("id") Long id, @Param("parameter1") String parameter1, @Param("parameter2") String parameter2, @Param("parameter3") BigDecimal parameter3, @Param("parameter4") BigDecimal parameter4, @Param("parameter5") BigDecimal parameter5, @Param("type") String type);

    @Select("select id from cb_amoeba_para_t where id = #{id}")
    Long selectAmoebaById(Long id);

    void amoebaInsert(@Param("id") Long id, @Param("type") String type);

    AmoebaEntity selectAmoebaList(@Param("date") String date, @Param("stockId") Long stockId);

    Integer amoebaUpdateByFZ(@Param("id") Long id, @Param("parameter5") BigDecimal parameter5, @Param("parameter6") BigDecimal parameter6, @Param("parameter7") BigDecimal parameter7, @Param("parameter8") BigDecimal parameter8, @Param("type") String type);
    //货架
    BigDecimal huoJia(@Param("stockId") Long stockId, @Param("date") String date);
}
